package oocl.ita.eordering.webService;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

import javax.ws.rs.core.MediaType;

import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.WebResource;

import oocl.ita.eordering.po.Merchant;
import oocl.ita.eordering.po.Order;

public class GetOrderStatusWS {
	
private static Properties prop = new Properties();
	
	public static Integer getOrderStatus(Integer oId) {
		Client client = Client.create();
		client.setReadTimeout(1000);
		
		/*try {
			prop.load(new FileInputStream(GetMerchantStatusWS.class.getClassLoader().getResource("ws.properties").getPath()));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		String url = prop.getProperty("orderUrl");
		WebResource wr = client.resource(url + oId);*/
		WebResource wr = client.resource("http://10.222.232.152:3010/order/get/status/"+ oId);
		String oStatusId = wr.queryParam("oId", oId.toString())
				.accept(MediaType.APPLICATION_JSON_TYPE)// accept请求头
				.get(String.class);
		Integer oStatusIdint = Integer.parseInt(oStatusId);
			System.out.println("oStatusIdint is ..." + oStatusIdint);
		return oStatusIdint;
		
	}

}
